home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2004 #11
/
Amiga Plus CD - 2004 - No. 11.iso
/
AmiSoft
/
Dev
/
misc
/
iff-rgfx.lha
/
IFF-RGFX
/
rgfx.h
< prev
next >
Wrap
C/C++ Source or Header
|
2004-08-29
|
9KB
|
274 lines
/*
** $VER: rgfx 2.0 (28.8.2004)
**
** Specs and structure definitions for the IFF-RGFX file format -
**
** (C) Copyright 1997-2004 Andreas R. Kleinert
** Freeware. All Rights Reserved.
*/
#ifndef RGFX_H
#define RGFX_H
#ifndef EXEC_TYPES_H
#include <exec/types.h>
#endif /* EXEC_TYPES_H */
#ifndef LIBARIES_IFFPARSE_H
#include <libraries/iffparse.h>
#endif /* LIBARIES_IFFPARSE_H */
/* *************************************************** */
/* * * */
/* * IFF/RGFX specific definitions and declarations * */
/* * * */
/* *************************************************** */
#define ID_FORM MAKE_ID('F','O','R','M') /* if not already defined */
#define ID_RGFX MAKE_ID('R','G','F','X') /* IFF-RGFX */
/* A typical structure of a RGFX file (recommended) :
FORM-RGFX
RGHD
RSCM
RCOL
RBOD
*/
/*******************************************************
RGHD - RawGfx Bitmap Header (mandatory)
** This one replaces BMHD
*/
#define ID_RGHD MAKE_ID('R','G','H','D')
struct RGHD
{
ULONG rgfx_LeftEdge; /* (see BMHD) */
ULONG rgfx_TopEdge; /* (see BMHD) */
ULONG rgfx_Width; /* (see BMHD) */
ULONG rgfx_Height; /* (see BMHD) */
ULONG rgfx_PageWidth; /* (see BMHD) */
ULONG rgfx_PageHeight; /* (see BMHD) */
ULONG rgfx_Depth; /* 1-8 for RMBT_BYTEPLANAR8,
1-8 for RMBT_BYTECHUNKY8,
15 for RMBT_2BYTERGB15
15 for RMBT_2BYTERGB16
24 for RMBT_3BYTERGB24
24 for RMBT_4BYTERGB32 */
ULONG rgfx_PixelBits; /* 1-8 for RMBT_BYTEPLANAR8,
8 for RMBT_BYTECHUNKY8,
15 for RMBT_2BYTERGB15
16 for RMBT_2BYTERGB16
24 for RMBT_3BYTERGB24
32 for RMBT_4BYTERGB32 */
ULONG rgfx_BytesPerLine; /* (width+7)/8 for RMBT_BYTEPLANAR8,
width for RMBT_BYTECHUNKY8,
width*2 for RMBT_2BYTERGB15
width*2 for RMBT_2BYTERGB16
width*3 for RMBT_3BYTERGB24
width*4 for RMBT_4BYTERGB32 */
ULONG rgfx_Compression; /* RCMP_ type flag */
ULONG rgfx_XAspect; /* (see BMHD) */
ULONG rgfx_YAspect; /* (see BMHD) */
ULONG rgfx_BitMapType; /* RBMT_ type flag */
};
/* if you encounter unknown depth/pixelbits/bytesperline combinations,
then do reject these (future expansions).
*/
#define RCMT_NOCOMPRESSION (0L)
#define RCMT_XPK (1L)
#define RMBT_BYTEPLANAR8 (0L) /* unaligned planar 8 bit bitmap */
#define RMBT_BYTECHUNKY8 (1<<0L) /* unaligned chunky 8 bit bitmap */
#define RMBT_3BYTERGB24 (1<<1L) /* 3-byte 24 bit RGB triples */
#define RMBT_4BYTERGB32 (1<<2L) /* 4-byte 32 bit ARGB quadruples */
#define RMBT_2BYTERGB15 (1<<4L) /* 2-byte 15 bit RGB (x+3x5 bit) */
#define RMBT_2BYTERGB16 (1<<5L) /* 2-byte 16 bit ARGB (1+3x5 bit) */
#define RMBT_6BYTERGB48 (1<<6L) /* 6-byte 48 bit RGB (3x 16 bit) */
#define RMBT_8BYTERGB64 (1<<7L) /* 8-byte 64 bit ARGB (4x 16 bit) */
#define RMBT_HAS_ALPHA (1<<31L) /* is the A in ARGB really used? */
/* Meaning of "A" (alpha information):
Definition is the same as in PNG:
0 means fully opaque and 1 (1 bit alpha) or 255 (8-bit alpha)
means fully transparent.
*/
/* ***************************************************** */
/*******************************************************
RGXY - RawGfx Aspect Info (optional)
** This one replaces BMHD's XAspect/YAspect
*/
#define ID_RGXY MAKE_ID('R','G','X','Y')
struct RGXY
{
ULONG rgfx_XAspect; /* (see BMHD) */
ULONG rgfx_YAspect; /* (see BMHD) */
ULONG rgfx_HasDouble; /* does a valid number follow? (TRUE/FALSE) */
DOUBLE rgfx_XYRatio; /* := x/y, IEEE754 (mathieedoubbas) */
LONG rgfx_VGAMode; /* see below */
};
/* as VGA mode, you can specifiy a Linux VGA mode, like
"788" (800x600, 16 bit color) to simplify the viewmode
selection. Negative values are reserved or defined as below:
*/
#define RGFX_VGAMODE_DEFAULT (0L) /* do not use! */
#define RGFX_VGAMODE_INVALID (-1L) /* use, if default */
#define RGFX_VGAMODE_AMIGAVIEW_MODE RGFX_VGAMODE_INVALID
#define RGFX_VGAMODE_PAL (-2L) /* 720x576 */
#define RGFX_VGAMODE_NTSC (-3L) /* 720x480 */
#define RGFX_VGAMODE_HDTV_720 (-4L) /* 720x1280 */
#define RGFX_VGAMODE_HDTV_1080 (-5L) /* 1080x1920 */
#define RGFX_VGAMODE_HDTV_1125 (-6L) /* */
#define RGFX_VGAMODE_HDTV_1250 (-7L) /* */
/*******************************************************/
/*******************************************************
RSCM - RawGfx ScreenMode (mandatory, processing optional)
** This one replaces CAMG.
The default setting is:
rscm_ViewMode: default screenmode
rscm_OBSOLETE: INVALID_ID
rscm_OBSOLETE: INVALID_ID
Note: Since HAM modes only can be identified by their
ID, you should make sure, that the ViewMode contains
HAM_KEY. The same for EHB and EXTRAHALFBRITE_KEY.
Specific RTG ViewModes will lose their meaning,
as soon as graphics are transferred between different
systems.
Always set the OBSOLETE entries to 0xFFFFFFFF;
*/
#define ID_RSCM MAKE_ID('R','S','C','M')
struct RSCM
{
ULONG rscm_ViewMode; /* 32 Bit AGA Viewmode ID */
ULONG rscm_OBSOLETE0; /* no longer supported */
ULONG rscm_OBSOLETE1; /* no longer supported */
};
/* ***************************************************** */
/*******************************************************
RCOL - RawGfx Colormap (optional for > 8 bit)
** This one replaces CMAP,
Required with RMBT_BYTEPLANAR8 and RMBT_BYTECHUNKY8,
and optionally allowed for the other modes as a
recommended dithering destination colormap.
Stored are 256 byte triples in RGB format. Note, that
full-range values (0..255) have to be stored.
Sample: rcol_Colors[0][0] = 0..255 red value, color #0 (1st)
rcol_Colors[0][1] = 0..255 green value, color #0
rcol_Colors[0][2] = 0..255 blue value, color #0
...
rcol_Colors[255][0] = 0..255 red value, color #255 (256th)
rcol_Colors[255][1] = 0..255 green value, color #255
rcol_Colors[255][2] = 0..255 blue value, color #255
Unused entries must be filled with zeroes.
Allowed boolean values for "rcol_TransColor": TRUE (1L) and FALSE (0L)
Note: With EHB mode, which e.g. uses 64 colors with only a 32 color
palette, you always should store the full color range within
the RCOL structure: if someone is going to display EHB pictures
on an RTG screen, he won't have to calculate the 'missing'
colors by himself.
Note: In case dithering of 16/32 bit graphics is done, the alpha
information gets lost! In this case, the transparent color
from below can be used. For example, if the transparent
color was BLACK (0,0,0) the effect surely will be the same.
*/
#define ID_RCOL MAKE_ID('R','C','O','L')
struct RCOL
{
ULONG rcol_TransColor; /* boolean: is there a transparent color ? */
ULONG rcol_TransColorNum; /* yes, it's number ... from the ones below */
UBYTE rcol_Colors[256][3];
};
/* ***************************************************** */
/*******************************************************
RBOD - RawGfx Bitmap Body (mandatory)
w
** This one replaces BODY
*/
#define ID_RBOD MAKE_ID('R','B','O','D')
/* May look like:
struct RBOD
{
UBYTE rbod_XPK[3]; ** containing 'XPK'
UBYTE rbod_BitMap[];
};
Or simply:
struct RBOD
{
UBYTE rbod_BitMap[];
};
This has not been defined as a union structure here, since some
compilers might add unwished pad bytes to the structure.
You should reference this chunk as an UBYTE array, only.
******************************************************* */
/*******************************************************
RGFX - Other chunks
- NAME, AUTH, ANNO and (C) chunks are allowed
******************************************************** */
#endif /* RGFX_H */